﻿#ifndef PST_MAINWINDOW_H
#define PST_MAINWINDOW_H

#include <QMainWindow>
#include <QProcess>
#include <QFrame>
#include "GlobalEnums.h"
#include "ElaWindow.h"

class T_Navigation;
class ElaContentDialog;
class ElaToolButton;
class ReportRelatedSubWidgetType;
namespace GenerateReport
{
    class CenterWidget;
    class MiniFloatingWindow;
    class T_TemplateDefinedWidget;

    class MainWindow : public ElaWindow
    {
        Q_OBJECT

    public:
        MainWindow(QWidget* parent = nullptr);
        ~MainWindow();

        void initWindow();
        void initEdgeLayout();
        //void initContent();
        void statusBarPromptInformation(QString informationText);
        void libreOfficeProcess(GenerateReport::ReportRelatedSubWidgetType widgetType, QPair<qint64, qint64> indexPair, QString reportName);
        void closeReportWidget();
        void action_screenshotToReport();
        /// @brief 更新创建报告的按钮状态
        /// @param state 按钮状态 true-可用
        void toolButtonCreateNewReportStateUpdate(bool state);
        void toolButtonReportRecordFormStateUpdate(bool state);

    private slots:
        void slot_toolBtnClick_CreateNewReport();
        void slot_toolBtnClick_GemerateFinalReport();
        void slot_toolBtnClick_ReportRecordForm();
        void slot_toolBtnClick_TemplateDefined();
        void slot_toolBtnClick_TemplateImport();
        void slot_toolBtnClick_TemplateExport();
        void slot_showMiniFloatingWindow();
        void slots_Timer();

    private:
        void initToolBar();
        /// @brief 初始化中心窗口
        void initContentWidget();
        /// @brief 初始化定时器，用于捕获截图信息
        void InitTimer();
        void initProjectData();
        void saveProjectData();

    private:
        /// @brief 中心视图
        CenterWidget* m_centerWidget{ nullptr };
        QProcess* m_libreOffice = Q_NULLPTR;
        ElaContentDialog* _closeDialog{ nullptr };
        /// @brief 悬浮窗
        MiniFloatingWindow* m_miniFloatingWindow{ nullptr };

        QThread* m_pThread = Q_NULLPTR;
        QTimer* m_pTimer = Q_NULLPTR;
        QString _elaDxgiKey{ "" };
        QString _viewKey{ "" };
        QString _aboutKey{ "" };
        QString _settingKey{ "" };
        ElaToolButton* m_toolButtonCreateNewReport{ nullptr };
        ElaToolButton* m_toolButtonReportRecordForm{ nullptr };
        T_Navigation* _navigationPage{ nullptr };
        T_TemplateDefinedWidget* m_templateDefinedWidget{ nullptr };
    };
}

#endif // PST_MAINWINDOW1_H
